Skip to content

fix(android): retain foreground close fence evidence - #4619

Merged
thymikee merged 8 commits into
0.22from
fix/android-foreground-fence-evidence
Nov 17, 2026
Merged

thymikee merged 8 commits into
0.22from
fix/android-foreground-fence-evidence

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Retain bounded Android foreground-close observations and timings in request diagnostics, including thrown probes, and document the fields. Isolate independent interaction-contract fixtures’ fake device claims. Seven files changed. The two-second fence, deadlines, queries, and launch/stop decisions remain unchanged.

Related: #4615. The original Android close failure and the initial five-second Coverage timeout remain unexplained. Fixture isolation addresses a separately reproduced subsequent claim collision.

Validation

  • Base 31fc8dfb079d7eac164651a98262fc9b5ba1c6fa; head 89ca287cbe90e7fd4944151de1c9da67b3fd753c. Exact affected: 11 passed, 8 skipped, 1 deduplicated; exact commit and unchanged checkout. Full format and quick checks passed.
  • The self-contained inherited-claim regression failed with DEVICE_CLAIM_LIVE_OWNER without isolation and passed with it; focused contract tests passed 7/7.
  • Hosted checks: 15 successful, 1 skipped, including successful Coverage and Android smoke. Complete independent seven-file source review at this head found no findings; all posted threads are resolved.
  • One fixed interleaved macOS comparison of fresh base/head builds did not reproduce a consistent help slowdown. It does not attribute the earlier sequential Linux CI measurement.
  • Lifecycle and daemon artifact tests cover separate boundaries. Artifact retention is source-traced; no full device-failure composition or manual device run is claimed.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.14 MB 6.14 MB +840 B
Package (unpacked) 6.14 MB 6.14 MB +840 B
Package (download) 1.86 MB 1.86 MB +275 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 24.8 ms 26.2 ms +1.3 ms
CLI --help 47.3 ms 49.4 ms +2.2 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

View guided diff | Turn on auto-fix | Re-trigger cubic

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

2 new findings away from what changed since a13f5f6 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (e0ab0c255c3d).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of a13f5f6e · 16.11.2026 23:44 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of ad488cc1 · 16.11.2026 23:29 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-android/src/app-lifecycle.ts:778 New error details and diagnostic phase are not in the owning help or user docs

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on ad488cc. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

The code at a13f5f6 looks right, but there is one gap in the evidence.

The change wraps the foreground probe on every Android close and open --relaunch (app-lifecycle.ts#L828). That is a device-facing app lifecycle route, and the fence behavior must stay the same. The PR body says live-device results are unverified, and the mocked tests here never reach the emulator close path. A mistake in the new try/finally or the bookkeeping would show up only there. Please show a green Android emulator run on this head, or a manual emulator run, where close and open --relaunch on a foreground app both succeed. Record the device, the sha, and the output that proves the close finished within the fence. For the evidence route, a forced timeout with an app that stays foreground should show details.foregroundObservations with at most five records, and an android_close_foreground_fence event in the request ndjson.

The Coverage job is red, but its log ends mid-run in the react-native companion test output with no failure line. Please rerun it and share the failing step output if it fails again. The untested unknown branch noted below may be part of it.

Not blocking, and you can take or leave each: the daemon test in request-router-android-foreground-evidence.test.ts mocks the lifecycle effect and emits the diagnostic itself, so it only checks generic persistence that already worked on the base commit. Either drop it or drive the production emission through the mocked adb provider inside the daemon request scope. waitForAndroidForegroundPackage gains two loose optional params, and targetPackage repeats the package name that the caller's matches callback already holds. A readForeground probe or a single options object would keep the loop unaware of observations. No test returns a null foreground app on the close route, so the unknown result is untested. One case in the foreground timeout table would cover it. The close help string now names the internal phase and detail fields. You could keep the field names in commands.md and mention only details.foregroundObservations in the help.

The resolved thread about help and docs coverage of the new fields is fixed at this head, so it can stay resolved: #4619 (comment).

Before merge, we need a green Android emulator run of close on this head and the actual output of the failing Coverage step.

@thymikee
thymikee merged commit 976b911 into 0.22 Nov 17, 2026
16 checks passed
@thymikee
thymikee deleted the fix/android-foreground-fence-evidence branch November 17, 2026 07:45
thymikee added a commit that referenced this pull request Nov 19, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 20, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 20, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 21, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 21, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 23, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
hannojg pushed a commit to hannojg/agent-device that referenced this pull request Nov 23, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
thymikee added a commit that referenced this pull request Nov 24, 2026
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant